/**
 * Created by o606633 on 17/04/2015.
 */
package cassy.client;

import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;

public class SimpleClient
{

    public static void main(String[] args)
    {
        SimpleClient simpleClient = new SimpleClient();
        simpleClient.Run();
    }

    private void Run()
    {
        Cluster cluster;
        Session session;

        cluster = Cluster.builder().addContactPoint("127.0.0.1").build();
        session = cluster.connect("demo");

        ResultSet results = session.execute("SELECT * FROM users");
        for (Row row : results)
        {
            System.out.format("%s %d\n", row.getString("firstname"), row.getInt("age"));
        }
    }
}
